package com.android.djlmapp.dialog;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.android.djlmapp.R;

/**
 * @Author wangziheng
 * @ProjectName djlm
 * @ClassName ChoosImgDialog
 * @package com.android.djlmapp.dialog
 * @data 2018/12/25 17:50
 * @Describe
 * @Change
 */
public class ChoosImgDialog extends Dialog {
    private Context mContext;

    private TextView mPhotoTv, mImgsTv, mCannelTv;
    public ChoosImgDialog(Context context) {
        super(context,R.style.dilogStyleBottom);
        mContext = context;
        init();
    }

    private void init() {
        setContentView(R.layout.choose_tab_layout);
        mPhotoTv = findViewById(R.id.dialog_Title_tv);
        mImgsTv =  findViewById(R.id.dialog_Content_tv);
        mCannelTv =  findViewById(R.id.dialog_cannel_tv);
        mPhotoTv.setText("拍照");
        mImgsTv.setText("相册");
        mCannelTv.setText("取消");
        setCanceledOnTouchOutside(false);
    }


    public void setItemClickListener(View.OnClickListener onClickListener){
        mPhotoTv.setOnClickListener(onClickListener);
        mImgsTv.setOnClickListener(onClickListener);
        mCannelTv.setOnClickListener(onClickListener);
    }
    public void showDialog() {
        show();
        WindowManager windowManager = ((Activity) mContext).getWindowManager();
        Display display = windowManager.getDefaultDisplay();
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.width = display.getWidth();
        getWindow().setAttributes(lp);
    }
}
